import request from '@/utils/request'

// 获取玩家列表
export function getPlayers(groupId) {
  return request({
    url: '/players',
    method: 'get',
    params: { groupId }
  })
}

// 创建玩家
export function createPlayer(data) {
  return request({
    url: '/player',
    method: 'post',
    data
  })
}

// 删除玩家
export function deletePlayer(playerId) {
  return request({
    url: `/player/${playerId}`,
    method: 'delete'
  })
}

// 更新玩家
export function updatePlayer(playerId, data) {
  return request({
    url: `/player/${playerId}`,
    method: 'put',
    data
  })
}

// 添加玩家到分组
export function addPlayerToGroup(playerId, groupId) {
  return request({
    url: `/player/${playerId}/group/${groupId}`,
    method: 'post'
  })
}

// 从分组移除玩家
export function removePlayerFromGroup(playerId, groupId) {
  return request({
    url: `/player/${playerId}/group/${groupId}`,
    method: 'delete'
  })
}
